package com.kavian.test.search.proxy;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class ProxySearch {

//	final static String URL = "http://www.googleadservices.com/pagead/aclk?sa=L&ai=BgU9aoDvQT9TpEIrbigfNxIH1Bv_ooPEC79e26TTvjdCxYaCNBhABGAEgovGUBTgAUKKhiPACYJ2x3oHYBaAB_YDW_AOyARBrYXZpYW4uaXRleWUuY29tugEKMTgweDE1MF9hc8gBAdoBI2h0dHA6Ly9rYXZpYW4uaXRleWUuY29tL2Jsb2cvMTY2Nzk5wAIFqAMByAMf6AP1KegD3AXoA6IE6AMF9QMAAABE9QMAAAAQiAYB&num=1&cid=5Gjk6yXiikAHVvtb0vvW9vKC&sig=AOD64_0rxTQrMMCg1nE58XpuTtqTTfAelg&client=ca-pub-1736516074862496&adurl=https://www.google.com/appserve/fb/forms/cnawcouponpp1000/%3Futm_source%3DRMKT_VisitorRMKT_text&nm=8&nx=72&ny=5&nh=1&clkt=119&jca=4181";
	final static String URL = "http://kavian.iteye.com/blog/1554353";
	final static String AGENT = "Mozilla/5.0 (Windows NT 5.1; rv:8.0.1) Gecko/20100101";

	public static void main(String[] args) throws Exception {
		// 生成 HttpClinet 对象
		HttpClient httpclient = new DefaultHttpClient();
		// 生成 GetMethod 对象
		HttpGet httpGet = new HttpGet(URL);
		// 设置请求头，这里很关键，细节在注意事项中描述
		httpGet.setHeader("user-agent",AGENT);
		httpGet.setHeader("accept", "*/*");
		httpGet.setHeader("accept-language", "zh-CN");
		httpGet.setHeader("accept-encoding", "utf-8");

		HttpResponse response = httpclient.execute(httpGet);
		HttpEntity entity = response.getEntity();

		System.out.println(EntityUtils.toString(entity));
	}
}
